package com.bjpowernode.javaweb.servlet;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.io.IOException;

public class VIPServlet extends GenericServlet{
    //还是会优先调用父类的init(ServletConfig config)方法
    @Override
    public void init() {
        System.out.println("重写的init方法执行了");
    }

    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        System.out.println("我是VIP，我牛逼。哈哈哈哈哈哈！");

        //想在VIPServlet子类中使用ServletConfig对象怎么办？
        ServletConfig config = this.getServletConfig();
        System.out.println("service方法调用ServletConfig对象" + config);
    }
}
